package com.thinkit.bigdata.web.service.impl.dataMining;

import com.thinkit.bigdata.web.model.result.HtmlResult;
import com.thinkit.bigdata.web.service.audioSearch.AudioSearchPubMet;
import com.thinkit.bigdata.web.service.dataMining.BusTrendViewService;
import org.apache.log4j.Logger;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

@Service
public class BusTrendViewServiceImpl implements BusTrendViewService {

    private static Logger logger = Logger.getLogger(BusTrendViewServiceImpl.class);

    @Resource
    private AudioSearchPubMet searchPubMet;

    @Override
    public HtmlResult getDateList(HttpServletRequest request) throws IllegalAccessException, InvocationTargetException {
        String logTxt = "【音频检索方法Impl】";
        logger.info(logTxt);
        Map<String, String[]> params = new HashMap<>(request.getParameterMap());
        return searchPubMet.searchData(logTxt, params, request);
    }

    @Override
    public BoolQueryBuilder getQuery(String logTxt, HttpServletRequest request) {
        Map<String, String[]> params = new HashMap<>(request.getParameterMap());
        return searchPubMet.getQuery(logTxt, params, request);
    }
}
